﻿@using Res = ViewRes.Event.EventsBySeriesStrings
@inherits VocaDb.Web.Code.VocaDbPage<VocaDb.Model.DataContracts.ReleaseEvents.ReleaseEventContract[]>

@{
	PageProperties.Title = ViewRes.SharedStrings.ReleaseEvents;

	var byYear = Model.Where(e => e.Date != null).GroupBy(e => e.Date.Value.Year).ToArray();

}

<ul class="nav nav-pills">
	<li>
		@Html.ActionLink(Res.ViewList, "Index")
	</li>
	<li>
		@Html.ActionLink(Res.ViewBySeries, "EventsBySeries")
	</li>
	<li class="active">
		@Html.ActionLink(Res.ViewByDate, "EventsByDate")
	</li>
</ul>

<table>
	@foreach (var year in byYear) {

		<tr>
			<td class="alignTop" colspan="2">
				<h3>
					@year.Key
				</h3>
			</td>
		</tr>

		foreach (var ev in year) {
			<tr><td>
				@ev.Date.Value.ToString("m")
			</td><td>
				<a href="@Url.Action("Details", new { id = ev.Id, slug = ev.UrlSlug })">
					@ev.Name
				</a>
			</td></tr>
		}

	}
</table>